package com.bdzl.pojo;

import java.util.Set;
import javax.persistence.Entity;
import javax.persistence.Table;

import org.hibernate.annotations.DynamicUpdate;

import java.util.HashSet;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import static javax.persistence.GenerationType.IDENTITY;
import javax.persistence.Id;
import javax.persistence.OneToMany;
/**
 * Agent entity. @author MyEclipse Persistence Tools
 * 代理人
 */
@Entity
@Table(name = "agent")
@DynamicUpdate(true)
public class Agent  {

	// Fields

	private Integer id;
	private String account;//登陆账号
	private String password;//登陆密码
	private String name;//昵称
	private String avatar;//用户头像地址
	private String sex;//性别
	private String number;//身份证号码
	private String tel;//电话号码
	private String company;//公司名称
	private Long time;//会员有效期时间结束时间
	private Float balance;//余额
	private Long beginTime;//注册时间
	private Integer state;//0注销 1正常登陆 
	private Set<Collectiona> collections = new HashSet<Collectiona>(0);
	private Set<AgentUser> agentUsers = new HashSet<AgentUser>(0);

	// Constructors

	/** default constructor */
	public Agent() {
	}

	/** full constructor */
	public Agent(String account, String password, String name,
			String avatar, String sex, String number, String tel,
			String company, Long time, Float balance, Long beginTime,
			Integer state, Set<Collectiona> collections,
			Set<AgentUser> agentUsers) {
		this.account = account;
		this.password = password;
		this.name = name;
		this.avatar = avatar;
		this.sex = sex;
		this.number = number;
		this.tel = tel;
		this.company = company;
		this.time = time;
		this.balance = balance;
		this.beginTime = beginTime;
		this.state = state;
		this.collections = collections;
		this.agentUsers = agentUsers;
	}

	// Property accessors
	@Id
	@GeneratedValue(strategy = IDENTITY)
	@Column(name = "id", unique = true, nullable = false)
	public Integer getId() {
		return this.id;
	}

	public void setId(Integer id) {
		this.id = id;
	}

	@Column(name = "account")
	public String getAccount() {
		return this.account;
	}

	public void setAccount(String account) {
		this.account = account;
	}

	@Column(name = "password")
	public String getPassword() {
		return this.password;
	}

	public void setPassword(String password) {
		this.password = password;
	}

	@Column(name = "name")
	public String getName() {
		return this.name;
	}

	public void setName(String name) {
		this.name = name;
	}

	@Column(name = "avatar")
	public String getAvatar() {
		return this.avatar;
	}

	public void setAvatar(String avatar) {
		this.avatar = avatar;
	}

	@Column(name = "sex")
	public String getSex() {
		return this.sex;
	}

	public void setSex(String sex) {
		this.sex = sex;
	}

	@Column(name = "number")
	public String getNumber() {
		return this.number;
	}

	public void setNumber(String number) {
		this.number = number;
	}

	@Column(name = "tel")
	public String getTel() {
		return this.tel;
	}

	public void setTel(String tel) {
		this.tel = tel;
	}

	@Column(name = "company")
	public String getCompany() {
		return this.company;
	}

	public void setCompany(String company) {
		this.company = company;
	}

	@Column(name = "time")
	public Long getTime() {
		return this.time;
	}

	public void setTime(Long time) {
		this.time = time;
	}

	@Column(name = "balance", precision = 12, scale = 0)
	public Float getBalance() {
		return this.balance;
	}

	public void setBalance(Float balance) {
		this.balance = balance;
	}

	@Column(name = "begin_time")
	public Long getBeginTime() {
		return this.beginTime;
	}

	public void setBeginTime(Long beginTime) {
		this.beginTime = beginTime;
	}

	@Column(name = "state")
	public Integer getState() {
		return this.state;
	}

	public void setState(Integer state) {
		this.state = state;
	}

	@OneToMany(cascade = CascadeType.ALL, fetch = FetchType.LAZY, mappedBy = "agent")
	public Set<Collectiona> getCollections() {
		return this.collections;
	}

	public void setCollections(Set<Collectiona> collections) {
		this.collections = collections;
	}

	@OneToMany(cascade = CascadeType.ALL, fetch = FetchType.LAZY, mappedBy = "agent")
	public Set<AgentUser> getAgentUsers() {
		return this.agentUsers;
	}

	public void setAgentUsers(Set<AgentUser> agentUsers) {
		this.agentUsers = agentUsers;
	}


}
